<?php
require 'menu_atas.php';
?>
<style>
input.error, textarea.error, select.error {
	background-color:#FFFFCC !important;
	border:1px solid #CC0000 !important;
}
label.error {
	color:#CC0000 !important;
	font-family:Arial, Helvetica, sans-serif !important;
	font-size:11px !important;
	padding-left:5px !important;
}
</style>
<?php
$username=$_SESSION['username'];
$sql="select * from tb_pendaftar where username='".$username."'";
//echo $sql;
$qry=mysql_query($sql);
$hasil=mysql_fetch_array($qry);
?>
  <div id="isi">

<form name="formlogin" id="form_login" action="aksi_daftar.php" method="post">

<table id="belang">
  <tr>
  	<th>No.Pendaftaran</th>
	<td><input type="hidden" value="<?php echo $hasil['no_pendaftaran']?>" name="no_pendaftaran" id="no_pendaftaran" /><div id="target_no_daftar"><?php echo $hasil['no_pendaftaran']?></div></td>
  </tr>
  <tr>
  	<th>Tanggal Daftar</th>
	<td><?php echo isset($hasil['tgl_daftar'])?$hasil['tgl_daftar']:date('d M Y');?>
  </tr>
  
  <tr>
  <th>Program Keahlian</th>
	<td>
	<select name="proli" id="proli" class="required">	
	<option value="">--Pilih Proli--</option>
    <?php
      // tampilkan proli
      $sql1 = mysql_query("SELECT * FROM tb_proli");
      while($k=mysql_fetch_array($sql1)){
		if($hasil['proli']==$k['kd_proli']){
			echo "<option selected value=$k[kd_proli]>$k[proli]</option> \n";
		}else{
			echo "<option value=$k[kd_proli]>$k[proli]</option> \n";
		}
         
      }
     ?>
      </select>
	</td>
	</tr>
	  <tr>
  	<th>Nama</th>
	<td><input type="text" value="<?php echo $hasil['no_pendaftaran']?>" name="nama" size="50" class="required" /></td>
  </tr>
   <tr>
<th>Jenis Kelamin</th>
  <td>
<input type="radio" <?php echo ($hasil['jk']=="male")?"checked":"";?> name="jk" value="1">Laki-laki
<input type="radio" <?php echo ($hasil['jk']=="female")?"checked":"";?> name="jk" value="2">Perempuan
  </td>
  </tr>  
    <tr>
	<tr>
  	<th>Tempat, Tgl Lahir</th>
	<td><input type="text" name="tmp_lahir" id="tmp_lahir" size="20" value="<?php echo $hasil['tmpt_lahir']?>" class="required" />, &nbsp; 
	<input type="text" name="tgl_lahir" id="tgl_lahir" size="10" value="<?php echo $hasil['tgl_lahir']?>" class="required" />
  </tr>
  <th>Agama</th>
	<td>
	<select name="agama" class="required">	
	<option value="">--Pilih Agama--</option>
    <?php
      // tampilkan agama
      $sql = mysql_query("SELECT * FROM tb_agama");
      while($k=mysql_fetch_array($sql)){
	  if($k['id_agama']==$hasil['agama']){
		 echo "<option selected value=$k[id_agama]>$k[agama]</option> \n";
	  }else{
		 echo "<option value=$k[id_agama]>$k[agama]</option> \n";
	  }
        
      }
     ?>
      </select>
	</td>
	</tr>
        <tr>
  	<th>Nama Orang Tua</th>
	<td><input type="text" value="<?php echo $hasil['nama_ortu']?>" name="nama_ortu" size="50" class="required" /></td>
  </tr>
  <tr>
  	<th>Pekerjaan Orang Tua</th>
	<td><input type="text" value="<?php echo $hasil['pekerjaan_ortu']?>" name="pekerjaan_ortu" size="50" class="required" /></td>
  </tr>
  <tr>
   	<th valign="middle">Alamat</th>
	<td><textarea name="alamat"  style="width:98%; height:50px;" class="required"><?php echo $hasil['alamat']?></textarea></td>
  </tr>
  <tr>
  	<th>No Handphone</th>
	<td><input type="text" value="<?php echo $hasil['no_hp']?>" name="no_hp" size="15" class="required" /></td>
  </tr>
 <tr>
  	<th>Asal Sekolah</th>
	<td><input type="text" value="<?php echo $hasil['asal_sekolah']?>" name="asal_sekolah" size="50" class="required" /></td>
  </tr>
  <tr>
  	<th>Nilai Matematika</th>
	<td><input type="text" value="<?php echo $hasil['matematika']?>" name="matematika" size="5" class="required" /></td>
  </tr>
   
  <tr>
  	<th>Nilai Bhs.Indonesia</th>
	<td><input type="text" value="<?php echo $hasil['indonesia']?>" name="indonesia" size="5" class="required" /></td>
  </tr>
  <tr>
  	<th>Nilai Bhs.Inggris</th>
	<td><input type="text" value="<?php echo $hasil['inggris']?>" name="inggris" size="5" class="required" /></td>
  </tr>
  <tr>
  	<th>Nilai IPA</th>
	<td><input type="text" value="<?php echo $hasil['ipa']?>" name="ipa" size="5" class="required" /></td>
  </tr>
	<tr><td colspan="2" align="center"><input type="submit" value="Daftar" /></td></tr>




</table>

</form>
 <script type="text/javascript">
$(document).ready(function(){
	$("#tgl_lahir").datepicker({
		dateFormat: 'yy-mm-dd'
	});
	$("#form_login").validate();
	
	$('select[name^="proli"]').live("change", function(){
		var id_jurusan = $("#proli").val();
		$.ajax({
			url: "ajax/get_no_pendaftar.php",
			data: "id_jurusan="+id_jurusan,
			dataType: 'json',
			cache: false,
			success: function(msg){
				//jika data sukses diambil dari server kita tampilkan
				//di <select id=kota>
				$("#no_pendaftaran").val(msg.no_pendaftaran);
				$("#target_no_daftar").html(msg.no_pendaftaran);
			}
		});
	});
});
</script>

 </div>
<?php
require 'footer.php';
?>